Loading TOC...

MarkLogic 9 Product Documentation
HEAD /v1/alert/rules/{name}

Summary

Test for the existence of a rule with the given name.

URL Parameters
database? Perform this operation on the named content database instead of the default content database associated with the REST API instance. Using an alternative database requires the "eval-in" privilege; for details, see Security Requirements in the REST Application Developer's Guide.

Response

If a rule with the given name was previously installed using PUT /v1/alert/rules/{name}, MarkLogic Server returns status 200. If no such rule exists, status 404 is returned.

If the Alerting API is not enabled, MarkLogic Server returns status 403.

Required Privileges

This operation requires the rest-writer role, or the following privilege:

http://marklogic.com/xdmp/privileges/rest-writer

Usage Notes

For more information, see Alerting in the REST Application Developer's Guide.

Example

$ curl --anyauth --user user:password -X HEAD -i \
    'http://localhost:8000/v1/alert/rules/json-example'

==> If the rule exists, MarkLogic Server responds with status code 200.
    If the rule does not exist, MarkLogic Server responds with status 404.
    A unsuccessful test returns output similar to the following:

HTTP/1.1 404 Not Found
Content-type: application/xml
Server: MarkLogic
Content-Length: 365
Connection: Keep-Alive
Keep-Alive: timeout=5

<rapi:error xmlns:rapi="http://marklogic.com/rest-api">
  <rapi:status-code>404</rapi:status-code>
  <rapi:status>Not Found</rapi:status>
  <rapi:message-code>RESTAPI-NODOCUMENT</rapi:message-code>
  <rapi:message>RESTAPI-NODOCUMENT: (err:FOER0000) Resource or document 
   does not exist:  category: alert-rules message: Rule named 'example' 
   not found
  </rapi:message>
</rapi:error>
  

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.